VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Extracts file path our of filename. E.G c:\temp\setup.exe returns c:\temp usage: Dim x as Long x =

by Fungus (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 22nd October 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Extracts file path our of filename. E.G c:\temp\setup.exe returns c:\temp usage: Dim x as Long x = GetFilePath(filename)

Rate Extracts file path our of filename. E.G c:\temp\setup.exe returns c:\temp usage: Dim x as Long x =



    Dim x As String
    Dim position As Integer
    Dim y As Integer
    Dim myPath As String

    x = filename

    For y = Len(x) To 1 Step -1
        If Mid(x, y, 1) = "\" Then
            position = y - 1
            Exit For
        End If
    Next y

myPath = Left(x, position)

GetFilePath = Format(myPath)

End Function

Download this snippet    Add to My Saved Code

Extracts file path our of filename. E.G c:\temp\setup.exe returns c:\temp usage: Dim x as Long x = Comments

No comments have been posted about Extracts file path our of filename. E.G c:\temp\setup.exe returns c:\temp usage: Dim x as Long x = . Why not be the first to post a comment about Extracts file path our of filename. E.G c:\temp\setup.exe returns c:\temp usage: Dim x as Long x = .

Post your comment

Subject:
Message:
0/1000 characters